
#include <winsock2.h>
#include <windows.h>
#include "event2/event-config.h"
#include "ipv6-internal.h"
#include "dmc-win32api.h"

char* gai_strerrorA(int ecode){
    DWORD	dwMsgLen;
    static char buff[GAI_STRERROR_BUFFER_SIZE + 1];
    dwMsgLen = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM
                             |FORMAT_MESSAGE_IGNORE_INSERTS
                             |FORMAT_MESSAGE_MAX_WIDTH_MASK,
                              NULL,
                              ecode,
                              MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                              (LPSTR)buff,
                              GAI_STRERROR_BUFFER_SIZE,
                              NULL);
    return buff;
}

WCHAR* gai_strerrorW(int ecode){
    DWORD dwMsgLen;
    static WCHAR buff[GAI_STRERROR_BUFFER_SIZE + 1];
    dwMsgLen = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM
                             |FORMAT_MESSAGE_IGNORE_INSERTS
                             |FORMAT_MESSAGE_MAX_WIDTH_MASK,
                              NULL,
                              ecode,
                              MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                              (LPWSTR)buff,
                              GAI_STRERROR_BUFFER_SIZE,
                              NULL);
    return buff;
}

#ifdef __cplusplus
extern "C" {
#endif
	#define IN6ADDR_ANY_INIT { 0 }
	const struct in6_addr in6addr_any;
#ifdef __cplusplus
}
#endif